/**
* 描述：简历中心
*/
<style lang="scss" scoped>
  @import '../index';
  .showInfo{
    margin-top: 10px;
  p{
    width:50%;
    display: inline-block;float: left;
  }
  .elItem{
    width:350px;
    display: inline-block;float: left;
  }
  }
  .clear{
    clear: both;
  }
  .btns-div{
    width:220px;margin:20px auto;
  }
  .btns-01{
    width:100px;line-height: 30px;height:30px;border:0 !important;padding:0;
  }
  .btns-02{
    width:100px;line-height: 30px;height:30px;padding:0;
  }
  .sexSpan{
    width:50%;background: #fff;line-height: 38px;text-align: center;color: #037aff;float: left;border:1px #037aff solid;cursor: pointer;
  }
  .sexCur{
    background: #037aff;color: #fff;border:1px #037aff solid;
  }
</style>
<template>
  <div>
    <div class="com-main-title">
      <span class="tit">简历中心</span>
      <div class="clear"></div>
    </div>
    <div class="resumeCenter-all">
      <div class="left">
        <div class="userName">{{info.name}}求职简历</div>
        <div class="infoPoint"><i class="y" :style="profileCompletenessData"></i></div>
        <i class="infoPointFonts">资料完成度：{{info.profileIntegrity | userInfoPoint}}</i>
        <div class="clear"></div>
        <div class="info" style="color:#999;font-size:12px;">更新：{{info.createdAt}}</div>
        <div class="info" style="color:#999;font-size:12px;">状态：{{!info.visible | visibleFilter}}</div>
        <!--<div class="info">账户名：{{info.screenName}}</div>-->
        <!--<div class="info">公开：完全保密</div>-->
        <div class="clear"></div>
      </div>
      <div class="rightBtns">
        <a @click="visibleFun(info.visible)">{{info.visible | visibleFilter}}</a>
        <a @click="preview">预览</a>
      </div>
      <div class="clear"></div>
    </div>
    <div class="resumeCenter-block resumeCenter-userInfo" v-if="!isModifyInfo">
      <img :src="`/api/pub/image/${info.avatar}`" alt="头像" class="touxiang" v-show="info.avatar"/>
      <img src="/static/images/web/userCenter/userGirl.png"  class="touxiang" v-show="!info.avatar && info.sex===2">
      <img src="/static/images/web/userCenter/userBoy.png"  class="touxiang" v-show="!info.avatar && info.sex===1">
      <div class="center">
        <div class="name">{{info.name}}</div>
        <!--<a class="tag radius05">完全保密</a>-->
        <div class="clear"></div>
        <div class="info">
          <i v-show="info.sex">{{info.sex | sexType}}</i><i v-show="!info.sex">未知性别</i>
          <i>丨</i>
          <i>{{info.birth | jsGetAge}}</i><i v-show="info.birth">（{{info.birth}}）</i><i v-show="!info.birth">未知生日</i>
          <i>丨</i>
          <i v-if="info.workExperience !== null || info.workExperience !== undefined">{{form.workExperience | userExperience}}工作经验</i><i v-else>未填写工作经验</i>
          <i>丨</i>
          <i v-show="info.cityId">现居{{info.cityId | cityAndType}}</i><i v-show="!info.cityId">现居地未知</i>
          <i>丨</i>
          <i v-show="intentInfo.status">{{intentInfo.status | intentStatus}}</i><i v-show="!intentInfo.status">当前状态未知</i>
        </div>
        <div class="clear"></div>
        <div class="email">
          <i class="iconUCenter iconUCenter_phone fl" style="margin-top:3px;"></i>
          <i class="fl" v-show="info.phone">{{info.phone}}</i>
          <i class="fl" v-show="!info.phone">未填写</i>
          <i class="iconUCenter iconUCenter_email fl" style="margin-top:5px;margin-left: 20px;"></i>
          <i class="fl" v-show="info.email">{{info.email}}</i>
          <i class="fl" v-show="!info.email">未填写</i>
        </div>
        <br>
        <span class="wth100">
          自我评价：<br>
          <!--<i>{{info.briefIntro}}</i>-->
          <p v-for="item in info.briefIntroList">{{item}}</p>
        </span>
        <div class="clear"></div>
      </div>
      <div class="resumeCenter-block-modiftBtns" style="width:18px;">
        <i class="iconUCenter iconUCenter_modify" @click="modifyUserInfoBtn()"></i>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
    </div>
    <div class="showInfo" v-if="isModifyInfo">
      <el-form ref="form" :model="form" :rules="ruleValidate" label-width="100px" class="lyx-form">
        <div style="float: left;">
          <Upload style="border:1px #047aff dashed;width:110px;height: 110px;margin:20px;"
                  multiple
                  type="drag"
                  accept="image/*"
                  ref="upload"
                  name="image"
                  :on-success="uploadSuccess"
                  :on-error="uploadError"
                  :before-upload="beforeUpload"
                  :show-upload-list="false"
                  :with-credentials="true"
                  action="/api/pub/image">
            <img src="/static/images/web/userCenter/userGirl.png" width="84" height="84" style="margin:11px auto;border:0;" v-show="!form.avatar && form.sex===2">
            <img src="/static/images/web/userCenter/userBoy.png" width="84" height="84" style="margin:11px auto;border:0;" v-show="!form.avatar && form.sex===1">
            <img :src="`/api/pub/image/${form.avatar}`" width="84" height="84" style="width:100%;height:106px;border:0;" v-show="form.avatar">
          </Upload>
          <div class="clear"></div>
          <a style="font-size: 14px;color: #999;text-align: center;display: block;margin-top:-10px;">修改</a>
        </div>
        <div style="float: right;margin-right:20px;margin-top:20px;width:700px;">
          <el-form-item label="姓名" class="elItem" prop="name">
            <el-input v-model="form.name"></el-input>
          </el-form-item>
          <el-form-item label="性别" class="elItem" prop="sex">
            <span class="sexSpan" :class="form.sex===1?'sexCur':''" @click="form.sex=1">男</span>
            <span class="sexSpan" :class="form.sex===2?'sexCur':''" @click="form.sex=2">女</span>
            <div class="clear"></div>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="生日" class="elItem" prop="birth">
            <el-date-picker
              v-model="form.birth"
              type="date" format="yyyy-MM-dd"
              placeholder="生日" @on-change="form.birth=$event" :editable="false">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="所在城市" class="elItem" prop="cityId">
            <el-select v-model="form.cityId" filterable placeholder="所在城市"  size="large">
              <el-option
                v-for="item in cityList"
                :key="item.id"
                :label="item.name"
                :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="邮箱账号" class="elItem">
            <el-input v-model="form.email"></el-input>
          </el-form-item>
          <el-form-item label="最高学历" class="elItem">
            <el-select placeholder="最高学历" v-model="form.education" clearable>
              <el-option :value="0" :key="0" :label="'中专(高中)'"></el-option>
              <el-option :value="1" :key="1" :label="'大专'"></el-option>
              <el-option :value="2" :key="2" :label="'本科'"></el-option>
              <el-option :value="3" :key="3" :label="'硕士'"></el-option>
              <el-option :value="4" :key="4" :label="'博士'"></el-option>
            </el-select>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="主修专业" class="elItem">
            <el-input v-model="form.major" placeholder="主修专业"></el-input>
          </el-form-item>
          <!--<el-form-item label="当前就职公司" class="elItem">-->
            <!--<el-input v-model="form.company"></el-input>-->
          <!--</el-form-item>-->
          <div class="clear"></div>
          <el-form-item label="工作经验" class="elItem">
            <el-select placeholder="工作经验" v-model="form.workExperience" clearable>
              <el-option :value="0" :key="0" :label="'1年以下'"></el-option>
              <el-option :value="1" :key="1" :label="'1－3年'"></el-option>
              <el-option :value="2" :key="2" :label="'3－5年'"></el-option>
              <el-option :value="3" :key="3" :label="'5－10年'"></el-option>
              <el-option :value="10" :key="10" :label="'10年以上'"></el-option>
            </el-select>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="自我评价" class="elItem">
            <el-input v-model="form.briefIntro" type="textarea" style="width:600px;" placeholder="请输入500字以内"></el-input>
          </el-form-item>
          <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="btns-div">
          <el-button type="primary" size="large" @click="modifyInfo('form')" class="btns-01">确定</el-button>
          <el-button type="defult" size="large" @click="cencel()" class="btns-02">取消</el-button>
        </div>
      </el-form>
      <div style="border-bottom:1px #eee dashed;"></div>
    </div>
    <div class="resumeCenter-block" v-if="!isModifyIntent">
      <div class="resumeCenter-block-tit">求职意向</div>
      <div class="resumeCenter-block-modiftBtns" style="margin-bottom:-20px;width:18px;">
        <i class="iconUCenter iconUCenter_modify" @click="modifyIntentInfoBtn()"></i>
        <div class="clear"></div>
      </div>
      <div class="clear"></div>
      <div class="resumeCenter-main">
        <span class="wth50">期望薪资：{{ intentInfo.salary | salaryState }}</span>
        <span class="wth50">地点：{{intentInfo.cityId | cityAndType}}</span>
        <span class="wth50">期望职位/职能：{{intentInfo.position | positionFilter}}</span>
        <span class="wth50">到岗时间：{{intentInfo.arrivalTime | arrivalTime}}</span>
        <span class="wth50">求职状态：{{intentInfo.status | intentStatus}}</span>
        <span class="wth100">职位类型：{{intentInfo.type | intentType}}</span>
        <br>
      </div>
    </div>
    <div v-if="isModifyIntent" style="border-bottom:1px #eee dashed;">
      <el-form ref="intentForm" :model="intentForm" :rules="intentRuleValidate" label-width="100px"  class="lyx-form">
        <el-form-item label="期望薪资" class="elItem" style="float: left;margin-top:30px;" prop="salary">
          <el-select v-model="intentForm.salary" placeholder="期望薪资" filterable style="width:250px;">
            <el-option v-for="item in salaryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <div class="clear" style="margin-top:-20px;"></div>
        <el-form-item label="求职状态" class="elItem" style="float: left;" prop="status">
          <el-select placeholder="求职状态" v-model="intentForm.status" clearable style="width:250px;">
            <el-option :value="0" :key="0" :label="'积极找工作'"></el-option>
            <el-option :value="1" :key="1" :label="'随便看看'"></el-option>
            <el-option :value="2" :key="2" :label="'暂时不换工作'"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="工作地点" class="elItem" style="float: left;" prop="cityId">
          <el-select v-model="intentForm.cityId" placeholder="工作地点" filterable style="width:250px;">
            <el-option v-for="item in cityList" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <div class="clear" style="margin-top:-20px;"></div>
        <el-form-item label="职位类型" class="elItem" style="float: left;" prop="type">
          <el-select placeholder="职位类型" v-model="intentForm.type" clearable style="width:250px;">
            <el-option :value="0" :key="0" :label="'全职'"></el-option>
            <el-option :value="1" :key="1" :label="'兼职'"></el-option>
            <el-option :value="2" :key="2" :label="'实习'"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="职位/职能" class="elItem" style="float: left;" prop="positionName">
          <el-input placeholder="请选择职位/职能" v-model="intentForm.positionName" :readonly="true" class="input-with-select">
            <el-button slot="append" icon="el-icon-search" @click="jobClassifyShow=true"></el-button>
          </el-input>
        </el-form-item>
        <div class="clear"></div>
        <el-form-item label="职位类型" class="elItem" style="float: left;" prop="arrivalTime">
          <el-select placeholder="职位类型" v-model="intentForm.arrivalTime" clearable style="width:250px;">
            <el-option :value="0" :key="0" :label="'随时'"></el-option>
            <el-option :value="1" :key="1" :label="'一周'"></el-option>
            <el-option :value="2" :key="2" :label="'两周'"></el-option>
            <el-option :value="3" :key="3" :label="'一个月'"></el-option>
            <el-option :value="4" :key="4" :label="'两个月'"></el-option>
            <el-option :value="5" :key="5" :label="'三个月'"></el-option>
            <el-option :value="6" :key="6" :label="'三个月以上'"></el-option>
          </el-select>
        </el-form-item>
        <div class="clear"></div>
        <div class="btns-div">
          <el-button type="primary" size="large" @click="modifyIntentInfo('intentForm')" class="btns-01">确定</el-button>
          <el-button type="defult" size="large" @click="cencel()" class="btns-02">取消</el-button>
        </div>
      </el-form>
    </div>
    <div class="resumeCenter-block">
      <div class="resumeCenter-block-tit">工作经验</div>
      <i class="add" @click="clickAdd(2)">+ 添加工作</i>
      <div class="clear"></div>
      <div v-for="(work, index) in allInfo.resumeList">
        <div class="resumeCenter-block-modiftBtns" style="margin-bottom:-20px;" v-if="isModifyWorkIndex!==index">
          <i class="iconUCenter iconUCenter_delete" @click="clickDelete(work.id, 1)"></i>
          <i class="iconUCenter iconUCenter_modify" @click="clickUpdate(2, index, work)" style="float: right;margin-left:30px;"></i>
          <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="resumeCenter-main" v-if="isModifyWorkIndex!==index">
          <span class="wth100">{{index + 1}}.公司名称：{{work.company}}</span>
          <div class="clear"></div>
          <span class="fl100" v-if="work.end">起始时间：{{work.start | formatDate}}&emsp;&emsp;至&emsp;&emsp;{{work.end | formatDate}}</span>
          <span class="fl100" v-if="!work.end">起始时间：{{work.start | formatDate}}&emsp;&emsp;至今</span>
          <div class="clear"></div>
          <span class="wth50">职位/职能：{{work.job}}</span>
          <div class="clear"></div>
          <span class="wth100">
          工作描述：<br>
          <p v-for="it in work.descriptionList">{{it}}</p>
          </span>
        </div>
        <div v-else>
          <el-form ref="`workForm${index}`" :model="workForm" :rules="workRuleValidate" label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;">
            <el-form-item label="起始时间" class="elItem" style="float: left;margin-top:30px;">
              <el-date-picker v-model="workForm.start" format="yyyy-MM-dd" type="date" style="width:150px;" placeholder="选择日期"></el-date-picker>
              <i>-</i>
              <el-date-picker v-model="workForm.end" format="yyyy-MM-dd" type="date" style="width:150px;" placeholder="选择日期"></el-date-picker>
              <i style="color: #999;font-size: 12px;">注：截止日期不填写则默认至今</i>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="公司名称" class="elItem">
              <el-input v-model="workForm.company" style="width:250px;"></el-input>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="职位/职能" class="elItem">
              <el-input v-model="workForm.job" :maxLength="25" style="width:250px;"></el-input>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="工作描述" class="elItem">
              <el-input type="textarea" v-model="workForm.description" :maxLength="25" :autosize="{ minRows: 4, maxRows: 8}" class="resume-textarea"></el-input>
            </el-form-item>
            <div class="clear"></div>
            <div class="btns-div">
              <el-button type="primary" size="small" @click="modifyWorkInfo('workForm')" class="btns-01">确定</el-button>
              <el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>
            </div>
          </el-form>
        </div>
      </div>
      <div v-if="addWorkInfoShow">
        <el-form ref="workForm" :model="workForm" :rules="workRuleValidate" label-width="100px" class="lyx-form">
          <el-form-item label="起始时间" class="elItem" style="float: left;margin-top:30px;">
            <el-date-picker v-model="workForm.start" type="date" style="width:150px;" placeholder="选择日期"></el-date-picker>
            <i style="padding:0 10px;">-</i>
            <el-date-picker v-model="workForm.end" type="date" style="width:150px;" placeholder="选择日期"></el-date-picker>
            <i style="color: #999;font-size: 12px;">注：截止日期不填写则默认至今</i>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="公司名称" class="elItem" prop="company">
            <el-input v-model="workForm.company" style="width:250px;"></el-input>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="职位/职能" class="elItem" prop="job">
            <el-input v-model="workForm.job" :maxLength="25" style="width:250px;"></el-input>
          </el-form-item>
          <el-form-item label="工作描述" class="elItem">
            <el-input type="textarea" v-model="workForm.description" :maxLength="250" :autosize="{ minRows: 4, maxRows: 8}" class="resume-textarea"></el-input>
          </el-form-item>
          <div class="clear"></div>
          <div class="btns-div">
            <el-button type="primary" size="small" @click="addWorkInfo('workForm')" class="btns-01">确定</el-button>
            <el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>
          </div>
        </el-form>
      </div>
    </div>
    <div class="resumeCenter-block">
      <div class="resumeCenter-block-tit fl">教育经历</div>
      <i class="add" @click="clickAdd(1)">+ 添加教育</i>
      <div class="clear"></div>
      <div v-for="(afo, index) in allInfo.educationList">
        <div class="resumeCenter-block-modiftBtns" style="margin-bottom:-20px;" v-if="educationIndex!==index">
          <i class="iconUCenter iconUCenter_delete" @click="clickDelete(afo.id, 2)"></i>
          <i class="iconUCenter iconUCenter_modify" @click="clickUpdate(1, index, afo)" style="float: right;margin-left:30px;"></i>
          <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="resumeCenter-main" v-if="educationIndex!==index">
          <span class="wth100">{{index + 1}}.毕业院校：{{afo.school}}</span>
          <div class="clear"></div>
          <span class="fl100">入学时间：{{afo.start | formatDate}}</span>
          <span class="fl100">毕业时间：{{afo.end | formatDate}}</span>
          <div class="clear"></div>
          <span class="wth100">学历学位：{{afo.degree | education}}</span>
          <div class="clear"></div>
          <span class="wth100">专业：{{afo.major}}</span>
        </div>
        <div v-else>
          <el-form :ref="`educationForm${index}`" :model="educationForm" :rules="educationRuleValidate" label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;padding-top:20px;">
            <el-form-item label="入学时间" class="elItem" style="float: left;" prop="start">
              <el-date-picker v-model="educationForm.start" type="date" style="width:180px;" placeholder="选择日期"></el-date-picker>
            </el-form-item>
            <el-form-item label="毕业时间" class="elItem" style="float: left;">
              <el-date-picker v-model="educationForm.end" type="date" style="width:180px;" placeholder="选择日期"></el-date-picker>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="院校" class="elItem" prop="school">
              <el-input v-model="educationForm.school" style="width:250px;"></el-input>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="专业" class="elItem" prop="major">
              <el-input v-model="educationForm.major" :maxLength="25" style="width:250px;"></el-input>
            </el-form-item>
            <div class="clear"></div>
            <el-form-item label="学历学位" class="elItem" prop="degree">
              <el-select placeholder="学历学位" v-model="educationForm.degree" clearable style="width:250px;">
                <el-option :value="0" :key="0" :label="'中专'"></el-option>
                <el-option :value="1" :key="1" :label="'大专'"></el-option>
                <el-option :value="2" :key="2" :label="'本科'"></el-option>
                <el-option :value="3" :key="3" :label="'硕士'"></el-option>
                <el-option :value="4" :key="4" :label="'博士'"></el-option>
                <el-option :value="5" :key="5" :label="'其它'"></el-option>
              </el-select>
            </el-form-item>
            <div class="clear"></div>
            <div class="btns-div">
              <el-button type="primary" size="small" @click="modifyEducationInfo()" class="btns-01">确定</el-button>
              <el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>
            </div>
          </el-form>
        </div>
      </div>
      <div v-show="isAddEducation">
        <el-form ref="addEducationForm" :model="educationForm" :rules="educationRuleValidate" label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;padding-top:20px;">
          <el-form-item label="入学时间" class="elItem" style="float: left;" prop="start">
            <el-date-picker v-model="educationForm.start" type="date" style="width:180px;" placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <el-form-item label="毕业时间" class="elItem" style="float: left;">
            <el-date-picker v-model="educationForm.end" type="date" style="width:180px;" placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="院校" class="elItem" prop="school">
            <el-input v-model="educationForm.school" style="width:250px;"></el-input>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="专业" class="elItem" prop="major">
            <el-input v-model="educationForm.major" :maxLength="25" style="width:250px;"></el-input>
          </el-form-item>
          <div class="clear"></div>
          <el-form-item label="学历学位" class="elItem" prop="degree">
            <el-select placeholder="学历学位" v-model="educationForm.degree" clearable style="width:250px;">
              <el-option :value="0" :key="0" :label="'中专'"></el-option>
              <el-option :value="1" :key="1" :label="'大专'"></el-option>
              <el-option :value="2" :key="2" :label="'本科'"></el-option>
              <el-option :value="3" :key="3" :label="'硕士'"></el-option>
              <el-option :value="4" :key="4" :label="'博士'"></el-option>
              <el-option :value="5" :key="5" :label="'其它'"></el-option>
            </el-select>
          </el-form-item>
          <div class="clear"></div>
          <div class="btns-div">
            <el-button type="primary" size="small" @click="addIntentInfo()" class="btns-01">确定</el-button>
            <el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>
          </div>
        </el-form>
      </div>
    </div>
    <!--<div class="resumeCenter-block">-->
      <!--<div class="resumeCenter-block-tit">简历附件</div>-->
      <!--<i class="add" @click="clickAdd(3)">+ 添加附件</i>-->
      <!--<div class="clear"></div>-->
      <!--<div v-for="(item, index) in resumeData.resumeFileList">-->
        <!--<div class="resumeCenter-block-modiftBtns" style="margin-bottom:-20px;" v-if="resumeData.resumeFIleIndex!==index">-->
          <!--<i class="iconUCenter iconUCenter_delete" @click="deleteResume(item.id)"></i>-->
          <!--<i class="iconUCenter iconUCenter_modify" @click="clickUpdate(3, index, item)" style="float: right;margin-left:30px;"></i>-->
          <!--<div class="clear"></div>-->
        <!--</div>-->
        <!--<div class="clear"></div>-->
        <!--<div class="resumeCenter-main" v-if="resumeData.resumeFIleIndex!==index">-->
          <!--<span class="fl100">文件名称：{{item.displayName}}</span>-->
          <!--<span class="fl100">上传时间：{{item.createdAt}}</span>-->
          <!--<div class="clear"></div>-->
        <!--</div>-->
        <!--<div v-else>-->
          <!--<el-form ref="`fileForm${index}`" :model="resumeData.resumeFileForm" label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;padding-top:20px;">-->
            <!--<el-form-item label="文件名称" class="elItem">-->
              <!--<el-input v-model="resumeData.resumeFileForm.displayName" style="width:250px;"></el-input>-->
            <!--</el-form-item>-->
            <!--<div class="clear"></div>-->
            <!--<div class="btns-div">-->
              <!--<el-button type="primary" size="small" @click="modifyFile(`fileForm${index}`)" class="btns-01">确定</el-button>-->
              <!--<el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>-->
            <!--</div>-->
          <!--</el-form>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div v-if="resumeData.resumeFIleAddShow">-->
        <!--<el-form label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;padding-top:20px;">-->
          <!--&lt;!&ndash;<el-form-item label="文件名称" class="elItem">&ndash;&gt;-->
            <!--&lt;!&ndash;<el-input v-model="resumeData.resumeFileForm.displayName" style="width:250px;"></el-input>&ndash;&gt;-->
          <!--&lt;!&ndash;</el-form-item>&ndash;&gt;-->
          <!--<el-form-item label="附件上传" class="elItem">-->
            <!--<Upload style="width: 110px;height: 110px;"-->
              <!--multiple-->
              <!--type="drag"-->
              <!--accept=""-->
              <!--ref="upload"-->
              <!--name="file"-->
              <!--:before-upload="beforeFileUpload"-->
              <!--:show-upload-list="false"-->
              <!--:with-credentials="true"-->
              <!--action="">-->
              <!--<div style="color: #eee;font-size: 50px;font-weight: normal;line-height: 50px;padding:30px;display:none;">+</div>-->
              <!--<img src="/static/images/web/company/wzlogo.png" style="width: 110px;height: 110px;display:none;">-->
              <!--<div v-if="!resumeData.fileName" style="text-align: center;width: 100%;line-height: 30px;padding:40px 0;font-size: 12px;">文件大小：111kb</div>-->
              <!--<div v-else style="text-align: center;width: 100%;line-height: 30px;padding:40px 0;font-size: 12px;">{{resumeData.fileName}}</div>-->
            <!--</Upload>-->
          <!--</el-form-item>-->
          <!--<div class="clear"></div>-->
          <!--<div class="btns-div">-->
            <!--<el-button type="primary" size="small" @click="addFile()" class="btns-01">确定</el-button>-->
            <!--<el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>-->
          <!--</div>-->
        <!--</el-form>-->
      <!--</div>-->
    <!--</div>-->
    <!--社交主页-->
    <!--<div class="resumeCenter-block">-->
      <!--<div class="resumeCenter-block-tit">社交主页</div>-->
      <!--<div class="clear"></div>-->
      <!--<div>-->
        <!--<div class="resumeCenter-block-modiftBtns" style="margin-bottom:-20px;">-->
          <!--<i class="iconUCenter iconUCenter_modify" style="float: right;margin-left:30px;"></i>-->
          <!--<div class="clear"></div>-->
        <!--</div>-->
        <!--<div class="clear"></div>-->
        <!--<div class="resumeCenter-main">-->
          <!--<span class="fl100">社交主页：</span>-->
          <!--<div class="clear"></div>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div class="clear"></div>-->
      <!--<el-form :model="resumeData.resumeFileForm" label-width="100px" class="lyx-form" style="border: 1px #409EFF dashed;margin:20px 0;padding-top:20px;">-->
        <!--<el-form-item label="社交主页" class="elItem">-->
          <!--<el-input v-model="resumeData.resumeFileForm.displayName" style="width:550px;"></el-input>-->
        <!--</el-form-item>-->
        <!--<div class="clear"></div>-->
        <!--<div class="btns-div">-->
          <!--<el-button type="primary" size="small" class="btns-01">确定</el-button>-->
          <!--<el-button type="defult" size="small" @click="cencel()" class="btns-02">取消</el-button>-->
        <!--</div>-->
      <!--</el-form>-->
    <!--</div>-->
    <job-classify v-model="jobClassifyShow" v-on:jobData="jobData"></job-classify>
  </div>
</template>
<script>
  import { mapState, mapActions } from 'vuex';
  import { modifyUser, getIntent, uploadIntent, uploadEducation, getResumeAndIntent, addEducation, resumeUpdate, resumeAdd, resumeFileList, resumeFileUpdate, resumeFiledelete, resumeDelete, deleteEducation, resumeFileAdd, visibleFun, profileCompleteness } from '@/service/web/user/userService';
  import { industry, district } from '@/service/web/selectService/selectMService';
  import JobClassify from '@/components/common/jobClassify/jobClassify';
  export default {
    components: {
      JobClassify
    },
    computed: {
      ...mapState([
        'userInfo'
      ])
    },
    data () {
      return {
        profileCompletenessData: {}, // 简历完成度
        industryList: [], // 行业字典集合
        cityList: [], // 城市集合
        isLogin: false,
        allInfo: {},
        // 个人基础信息
        info: {},
        form: {},
        isModifyInfo: false,
        partFile: null,
        ruleValidate: {
          name: [
            {required: true, message: '姓名不能为空', trigger: 'blur change'}
          ],
          birth: [
            {required: true, message: '生日不能为空', trigger: 'blur change'}
          ],
          cityId: [
            {required: true, type: 'number', message: '所在城市不能为空', trigger: 'blur change'}
          ],
          email: [
            {pattern: '^\\w+([.-]?\\w+)@\\w+([.-]?\\w+)(.\\w{2,3})+$', message: '请输入正确的邮箱格式', trigger: 'change blur'}
          ],
          screenName: [
            {required: true, message: '用户名称不能为空', trigger: 'blur'},
            {pattern: '^[\\w_-]{5,20}$', message: '仅允许数字、字母、下划线、中划线', trigger: 'change blur'}
          ]
        },
        // 求职意向
        isModifyIntent: false,
        intentInfo: {},
        intentForm: {},
        intentRuleValidate: {
          salary: [
            {required: true, type: 'number', message: '期望薪资不能为空', trigger: 'blur'}
          ],
          cityId: [
            {required: true, type: 'number', message: '求职城市不能为空', trigger: 'blur'}
          ],
          industry: [
            {required: true, message: '行业不能为空', trigger: 'blur'}
          ],
          positionName: [
            {required: true, message: '职位不能为空', trigger: 'blur'}
          ],
          status: [
            {required: true, message: '求职状态不能为空', trigger: 'blur'}
          ],
          type: [
            {required: true, message: '职位类型不能为空', trigger: 'blur'}
          ]
        },
        // 教育经历
        isModifyEducation: false,
        isAddEducation: false,
        educationIndex: null,
        educationInfo: {},
        educationForm: {},
        educationRuleValidate: {
          start: [
            {required: true, message: '入学时间不能为空', trigger: 'blur'}
          ],
          major: [
            {required: true, message: '专业不能为空', trigger: 'blur'}
          ],
          school: [
            {required: true, message: '院校不能为空', trigger: 'blur'}
          ],
          degree: [
            {required: true, message: '学位不能为空', trigger: 'blur'}
          ]
        },
        // 工作经历
        isModifyWork: false,
        addWorkInfoShow: false,
        isModifyWorkIndex: null,
        workInfo: {},
        workForm: {},
        workRuleValidate: {
          company: [
            {required: true, message: '当前就职公司不能为空', trigger: 'blur'}
          ],
          job: [
            {required: true, message: '职位不能为空', trigger: 'blur'}
          ]
        },
        // 简历上传
        resumeData: {
          resumeFileList: [],
          resumeFileForm: {},
          resumeFIleIndex: null,
          resumeFIleAddShow: false,
          resumeFile: null,
          fileName: null
        },
        jobClassifyShow: false,
        salaryList: [
          {value: 0, label: '面议'},
          {value: 1, label: '1000-2000'},
          {value: 2, label: '2000-3000'},
          {value: 3, label: '3000-4000'},
          {value: 4, label: '4000-5000'},
          {value: 5, label: '5000-8000'},
          {value: 6, label: '8000-10000'},
          {value: 7, label: '10000-15000'},
          {value: 8, label: '15000-20000'},
          {value: 9, label: '20000-30000'},
          {value: 10, label: '30000-50000'},
          {value: 11, label: '50000-100000'},
          {value: 12, label: '100000以上'}
        ]
      };
    },
    mounted () {
    },
    async created () {
      this.getIntent();
      this.getAllInfo();
      this.resumeFileList();
      this.getIndustryList();
      this.getAllCityList();
      this.getCurrentUser();
    },
    methods: {
      ...mapActions([
        'getUserInfo'
      ]),
      async getCurrentUser () {
        await this.getUserInfo();
        let result = await profileCompleteness();
        this.profileCompletenessData.width = result.data;
        this.info = Object.assign({}, this.userInfo);
        this.info.briefIntroList = [];
        if (this.info.briefIntro) { // 格式化自我评价
          let briefIntro = this.info.briefIntro.replace(/\n/g, ';');
          this.info.briefIntroList = briefIntro.split(';');
        }
      },
      // 获取用户求职意向
      async getIntent () {
        let res = await getIntent();
        this.intentInfo = res.data || {};
      },
      // 获取所有其他
      async getAllInfo () {
        let res = await getResumeAndIntent();
        this.allInfo = res.data;
        if (this.allInfo.resumeList && this.allInfo.resumeList.length) {
          this.allInfo.resumeList.forEach(item => {
            let description = item.description.replace(/\n/g, ';');
            item.descriptionList = description.split(';');
          });
        }
      },
      cencel () {
        this.resumeData.resumeFIleAddShow = false;
        this.resumeData.resumeFIleIndex = null;
        this.isModifyWorkIndex = null;
        this.addWorkInfoShow = false;
        this.educationIndex = null;
        this.isAddEducation = false;
        this.isModifyInfo = false;
        this.isModifyIntent = false;
        this.isModifyEducation = false;
      },
      // -------------------------- 修改基础信息 ----------------------------
      modifyInfo (name) {
        if (this.form.birth) this.form.birth = this._hyTool.DateFormat(new Date(this.form.birth), 'yyyy-MM-dd hh:mm:ss');
        this.$refs[name].validate((valid) => {
          if (valid) {
            modifyUser(this.form).then((data) => {
              this.$Notice.success({title: '设置成功'});
              this.getCurrentUser();
              this.isModifyInfo = false;
            }).catch(e => {
              this.isModifyInfo = true;
            });
          }
        });
      },
      modifyUserInfoBtn () {
        this.cencel();
        this.isModifyInfo = true;
        this.form = this._hyTool.deepCopy(this.info);
      },
      // -------------------------- 修改求职意向 ----------------------------
      modifyIntentInfo (name) {
        this.$refs[name].validate(async (valid) => {
          if (valid) {
            await uploadIntent(this.intentForm);
            this.$Notice.success({title: '设置成功'});
            this.getCurrentUser();
            this.getIntent();
            this.isModifyIntent = false;
          }
        });
      },
      modifyIntentInfoBtn () {
        this.cencel();
        this.isModifyIntent = true;
        this.intentForm = this._hyTool.deepCopy(this.intentInfo);
        this.intentForm.positionName = this.intentForm.position;
        let result = this._hyTool.getStore('jobListData');
        let jobListData = JSON.parse(result);
        let jobListDataObject = jobListData.find(item => item.id === this.intentForm.position);
        if (jobListDataObject) this.intentForm.positionName = jobListDataObject.label;
      },
      // -------------------------- 修改教育经历 ----------------------------
      async modifyEducationInfo () {
        if (this.educationForm.start) {
          this.educationForm.start = this._hyTool.DateFormat(new Date(this.educationForm.start), 'yyyy-MM-dd hh:mm:ss');
        } else {
          this.educationForm.start = '';
        }
        if (this.educationForm.end) {
          this.educationForm.end = this._hyTool.DateFormat(new Date(this.educationForm.end), 'yyyy-MM-dd hh:mm:ss');
        } else {
          this.educationForm.end = '';
        }
        await uploadEducation({id: this.educationForm.id}, this.educationForm);
        this.$Notice.success({title: '修改成功'});
        this.cencel();
        this.getAllInfo();
      },
      addIntentInfo () {
        this.$refs.addEducationForm.validate(async (valid) => {
            if (valid) {
            if (this.educationForm.start) {
              this.educationForm.start = this._hyTool.DateFormat(new Date(this.educationForm.start), 'yyyy-MM-dd hh:mm:ss');
            } else {
              this.educationForm.start = '';
            }
            if (this.educationForm.end) {
              this.educationForm.end = this._hyTool.DateFormat(new Date(this.educationForm.end), 'yyyy-MM-dd hh:mm:ss');
            } else {
              this.educationForm.end = '';
            }
            await addEducation(this.educationForm);
            this.$Notice.success({title: '添加成功'});
            this.isAddEducation = false;
            this.getAllInfo();
          }
        });
      },
      // -------------------------- 修改工作经历 ----------------------------
      async modifyWorkInfo () {
        if (this.workForm.start) {
          this.workForm.start = this._hyTool.DateFormat(new Date(this.workForm.start), 'yyyy-MM-dd hh:mm:ss');
        } else {
          this.workForm.start = '';
        }
        if (this.workForm.end) {
          this.workForm.end = this._hyTool.DateFormat(new Date(this.workForm.end), 'yyyy-MM-dd hh:mm:ss');
        } else {
          this.workForm.end = '';
        }
        await resumeUpdate({id: this.workForm.id}, this.workForm);
        this.$Notice.success({title: '修改成功'});
        this.cencel();
        this.getAllInfo();
      },
      addWorkInfo () {
        this.$refs.workForm.validate(async (valid) => {
          if (valid) {
            if (this.workForm.start) {
              this.workForm.start = this._hyTool.DateFormat(new Date(this.workForm.start), 'yyyy-MM-dd hh:mm:ss');
            } else {
              this.workForm.start = '';
            }
            if (this.workForm.end) {
              this.workForm.end = this._hyTool.DateFormat(new Date(this.workForm.end), 'yyyy-MM-dd hh:mm:ss');
            } else {
              this.workForm.end = '';
            }
            await resumeAdd(this.workForm);
            this.$Notice.success({title: '添加成功'});
            this.cencel();
            this.getAllInfo();
          }
        });
      },
      // -------------------------- 上传头像 ----------------------------
      beforeUpload (file) { // 保存需要上传的文件
        if (file.size > 1024 * 1024 * 5) {
          this.$Notice.warning({
            title: '文件大小小不能超过5MB。'
          });
        }
        this.partFile = file;
      },
      // 上传文件成功
      async uploadSuccess (response, file, fileList) {
        this.$Notice.success({title: '上传成功'});
        this.form.avatar = response.data.ossKey;
      },
      // 上传错误
      async uploadError () {
        this.$Notice.error({title: '上传失败'});
      },
      // 点击添加
      clickAdd (type) {
        if (type === 1) {
          this.educationForm = {};
          this.isAddEducation = true;
        } else if (type === 2) {
          this.workForm = {};
          this.addWorkInfoShow = true;
        } else if (type === 3) {
          this.resumeData.resumeFileForm = {};
          this.resumeData.resumeFile = null;
          this.resumeData.fileName = null;
          this.resumeData.resumeFIleAddShow = true;
        }
      },
      // 点击修改
      clickUpdate (type, index, item) {
        if (type === 1) {
          this.educationIndex = index;
          this.educationForm = item;
          this.educationForm.start = new Date(this.educationForm.start);
          this.educationForm.end = new Date(this.educationForm.end);
          this.isAddEducation = false;
        } else if (type === 2) {
          this.isModifyWorkIndex = index;
          this.workForm = item;
          this.workForm.start = new Date(this.workForm.start);
          this.workForm.end = new Date(this.workForm.end);
          this.isAddEducation = false;
        } else if (type === 3) {
          this.resumeData.resumeFIleIndex = index;
          this.resumeData.resumeFileForm = item;
          this.resumeData.resumeFileForm.displayName = this.resumeData.resumeFileForm.displayName.split('.')[0];
        }
      },
      // -------------------------- 简历上传 ----------------------------
      // 查询简历列表
      async resumeFileList () {
        let result = await resumeFileList();
        this.resumeData.resumeFileList = result.data;
      },
      // 修改简历
      async modifyFile () {
        await resumeFileUpdate({id: this.resumeData.resumeFileForm.id}, {displayName: this.resumeData.resumeFileForm.displayName});
        this.$Notice.success({title: '修改成功'});
        this.cencel();
        this.resumeFileList();
      },
      // 增加简历
      async addFile () {
        if (!this.resumeData.resumeFile) {
          this.$Notice.warning({title: '请选择文件。'});
          return;
        }
        let fd = new window.FormData();
        fd.append('file', this.resumeData.resumeFile);
        let result = await resumeFileAdd(fd);
        console.log(result);
        this.cencel();
        this.resumeFileList();
        this.$Notice.success({title: '上传成功'});
      },
      beforeFileUpload (file) { // 保存需要上传的文件
        if (file.size > 1024 * 1024 * 5) this.$Notice.warning({title: '文件大小小不能超过5MB。'});
        this.resumeData.resumeFile = file;
        this.resumeData.fileName = file.name;
      },
      // 删除简历
      async deleteResume (id) {
        this.$confirm('确定删除简历？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          await resumeFiledelete({id: id});
          this.$Notice.success({title: '删除成功'});
          this.cencel();
          this.resumeFileList();
        }).catch(() => {
        });
      },
      // 获取全国城市集合
      async getAllCityList () {
        let result = await district({type: 10});
        this.cityList = result.data;
      },
      // 获取行业字典
      async getIndustryList () {
        let result = await industry();
        this.industryList = result.data;
      },
      // 职位主键返回值
      jobData (jobData) {
        console.log(jobData);
        this.intentForm.position = jobData.id;
        this.intentForm.positionName = jobData.label;
        this.intentForm.industry = jobData.industryId;
        this.workForm.position = jobData.id;
        this.workForm.positionName = jobData.label;
        this.workForm.industry = jobData.industryId;
      },
      preview () {
        this.$router.push('/exportResume');
      },
      // 删除
      clickDelete (id, type) {
        this.$confirm('确定删除？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          if (type === 1) {
            await resumeDelete({id: id});
          } else if (type === 2) {
            await deleteEducation({id: id});
          }
          this.getAllInfo();
          this.$Notice.success({title: '删除成功'});
        }).catch(() => {
        });
      },
      // 修改状态
      async visibleFun (val) {
        this.$confirm('确定修改？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
          await visibleFun({visible: !val});
          this.getCurrentUser();
          this.$Notice.success({title: '修改成功'});
        }).catch(() => {
        });
      }
    }
  };
</script>
